package cn.com.dingtek.genius.manager.server.support;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum AuthRuleType {
    /**
     *
     */
    VIEW(1, "页面"),
    API(2, "接口"),
    DATA(3, "数据");

    private int value;
    private String desc;

    AuthRuleType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static AuthRuleType valueOf(Integer value) {
        return Arrays.stream(AuthRuleType.values())
                .filter(item -> item.getValue() == value)
                .findFirst().get();
    }

    @Override
    public String toString() {
        return desc;
    }
}
